package com.impak.infoot.service.impl

import com.impak.infoot.service.IPlayerService
import com.impak.infoot.domain.foot.Player
import com.impak.infoot.domain.foot.Team
import com.impak.infoot.domain.foot.PlayerTeam
import com.impak.infoot.domain.foot.Match

/**
 * Implementation of the interface IPlayerService
 * @author nzouabi
 *
 */
class PlayerService implements IPlayerService {
	
	def getPlayer(playerId) {
		Player.get(playerId)
	}
	
	def getTeamPlayers(teamId, date) {
		def team = Team.get(teamId)
		def c = PlayerTeam.createCriteria()
		def results = c.list {
			and {
				eq("team", team)
				le("startDate",date)
				ge("endDate",date)
			}
			projections {
				property "player"
			}
		}
	}
	
	
	def getPlayersOfTeamInMatch(teamId, matchId) {
		def match = Match.get(matchId)
	}


}
